package priv.bruce.servlet;

import java.io.IOException;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.alibaba.fastjson.JSON;

import priv.bruce.service.MovieInfoService;

public class FindMovieInfoByIdServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;

	private MovieInfoService movieInfoService = new MovieInfoService();

	protected void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("application/json;charset=utf-8");
		
		int id = Integer.parseInt(request.getParameter("id"));
		try {
			List<Map<String, String>> findById = movieInfoService.findById4Detail(id);
			response.getWriter().append(JSON.toJSONString(findById));
		} catch (SQLException e) {
			e.printStackTrace();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
